import Vue from 'vue'
import Vuex from 'vuex'
import about from "./modules/about.js"

Vue.use(Vuex)

const SET_COUNT = "SET_COUNT"

let state = {
  count: 123
}

let mutations = {
  [SET_COUNT](state,num){
    // state.count = num
    console.log("index-mutations")
  }
}

let actions = {
  getData({commit,dispatch},num){
    commit("SET_COUNT",num)
    dispatch("rootAction")
  }
}

let getters = {
  countGetters(state,getters,rootState,rootGetters){
    // console.log(state)
    // console.log(getters)
    // console.log(rootState)
    // console.log(rootGetters)
    return state.count
  }
}

let modules = {
  about
}

export default new Vuex.Store({
  state,
  mutations,
  actions,
  getters,
  modules
})
